#!/usr/bin/env python

"""
A Python module for automatically filling out web forms.
"""

import sys    # cmd line argument processing
try:
    import requests    # easy URL handling
except ImportError:
    print "Could not import requests module."


payload = {'firstName': 'Paul',
          'lastName': 'Liebman',
          'email': 'paul.liebman@austin.utexas.edu',
          'phone': '877-507-7321 ',
          'numGuests': '25',
          'address': '1616 Guadalupe, Suite 2.206  Austin, TX 78701',
          'date': 'August 9, 2014',
          'time': '8:00 PM',
          'comments': 'Yo!  This party is gonna be off tha chain!'}

def getUrl(u):
    print "Fetching form from ", u, "..."
    r = requests.get(u)
    return r

def postUrl(u):
    print "Sending form to ", u, "..."
    r = requests.post(u, payload)
    return r


if __name__ == "__main__":
    url = sys.argv[1]
    req = getUrl(url)
    form = putUrl(url)
